using Beetle.Modules.BtAdminUI.Wasm;
using Beetle.Modules.BtHttpClientModule;
using BlazorDownloadFile;
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;

namespace Beetle.Exes.BtAdminUI.Wasm;

public class Program
{
    public static async Task Main(string[] args)
    {
        var builder = WebAssemblyHostBuilder.CreateDefault(args);
        builder.RootComponents.Add<App>("#app");
        builder.RootComponents.Add<HeadOutlet>("head::after");

        builder.Services.AddLogging(builder => builder
            // .AddBrowserConsole()
            .SetMinimumLevel(LogLevel.Trace)
            .AddFilter("System.Net.Http.HttpClient.beetle-api.ClientHandler", LogLevel.Warning)
        );
        // Mediatr
        builder.Services.AddMediatR(cfg =>
        {
            cfg.RegisterServicesFromAssemblyContaining<Program>();
        });
        builder.AddAdminUIWasmServices();

        await builder.Build().RunAsync();
    }
}
